#ifndef GAME_H
#define GAME_H
#include <vector>
#include "worldobject.h"
#include "score.h"
#include "powerup.h"




using namespace std;

class Game
{
  vector<WorldObject *> objects;
  PowerUp powerUp;
  Score score;
  int difficulty;


public:
  int lives;

  //constructor
  Game();

  //destructor
  ~Game();

  WorldObject *createObject(string type, int xPos, int yPos);

  int getScore() {return score.getScore();}
  int getLives() {return lives;}

  void setScore(int newScore) {score.setScore(newScore);}
  void setLives(int oldLives) {lives = oldLives;}
  void incrementScore(int incScore) {score.setScore(score.getScore() + incScore);}

  //Receives difficulty prompt from UI, sets difficulty
  void setDifficulty(int newDiff) {difficulty = newDiff;}

  //loads gamesave file, and passes each line to appropriate constructor
  void loadGame();

  //saves values for numbers of objects, then iterates through gameObjects, and calls the Save() method for each object, then adds powerup values at the end.
  void saveGame(int difficulty);

  void display();

  WorldObject* getObjectByID(int value) {return objects.at(value);}

  //Returns size of objects
  int getObjectVectorSize() {return objects.size();}

  /*builds gameObjects by determining how many of each object should be made,
    assigns values for objects, and calls the appropriate instantiators.
    Also sets PacMan's lives*/
  void createWorld(int numWalls);

  //calls WorldObject::move() on dynamic objects in vector
  void move();

  int collisionTest(WorldObject* attacker, WorldObject* victim);

  //move Paddle based on velocity; calls WorldObject::move()
  void movePaddle(int paddle, int direction);

  //PacMan has hit a ghost!  Oops... Lose a life, reset PacMan and Ghost positions
  void eat(WorldObject *Predator, WorldObject *Prey);

  vector<int> positionWall();
  vector<int> getDimensions(WorldObject *obj);
  void createDots(int numWalls);
};

#endif // GAME_H
